//
//  GCSettingViewController.m
//  GoldChampion
//
//  Created by Mac on 2018/4/11.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "GCCommentNotifactionViewController.h"
@interface GCCommentNotifactionViewController ()
@property(nonatomic, strong) NSArray                     *dataSouce;

@end

@implementation GCCommentNotifactionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"通知设置";
    [self configDataSouce];
    
    // Do any additional setup after loading the view.
}

- (void)configDataSouce{
    
    
    UIImageView * imagview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 18, 11)];
    imagview.image = [UIImage imageNamed:@"选择"];
    
    self.dataSouce = @[
                       [[STTableEasyModel alloc] initWithTextString:@"所有人"
                                                       accessoryView:imagview],
                       [[STTableEasyModel alloc] initWithTextString:@"我关注的人"
                                                      accessoryView:nil],
                       [[STTableEasyModel alloc] initWithTextString:@"关闭"
                                                      accessoryView:nil],
                       ];
    [self.tableView reloadData];
    
}

#pragma --mark UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return [self.dataSouce count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 55;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 44;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 10;
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return [TMUtils sectionHeaderWithTitle:@"我将收到这些人对我作品的评论通知"];
}
- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return [UIView new];
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * reuseIdentifier =  @"cell";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        
    }
    STTableEasyModel * model = self.dataSouce[indexPath.row];
    [cell setSt_tableEasyModel:model];
    return cell;
}
#pragma --mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
    
    for (STTableEasyModel * model in self.dataSouce) {
        model.accessoryView = nil;
    }
    UIImageView * imagview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 18, 11)];
    imagview.image = [UIImage imageNamed:@"选择"];
    
    STTableEasyModel * model = self.dataSouce[indexPath.row];
    model.accessoryView = imagview;
    [self.tableView reloadData];

}


@end


